using Microsoft.EntityFrameworkCore;
using Admin3000.Backend.Api.Entity;

namespace Admin3000.Backend.Api.Db
{
    public class Admin3000Db : DbContext
    {
        // 因为我们使用AddDbContext到容器，所以此处必须得有带参数的构造函数（而且必须传递DbContextOptions类型的参数，同时父类也得调用这个参数）
        public Admin3000Db(DbContextOptions options):base(options)
        {

        }

        public DbSet<Users> Users { get; set; }
        public DbSet<Roles> Roles { get; set; }
        public DbSet<UserRoles> UserRoles { get; set; }
        public DbSet<AuditInfo> AuditInfo { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder builder)
            => builder.UseSqlServer(@"server=.;database=Admin3000;uid=sa;pwd=123456;");
    }
}